#pragma once
#include "RibbonCompiler.h"

#include <vector>
#include <string>
#include <map>

using namespace std;

class CRibbonInfo
{
private:
	const CRibbonCompiler &m_ribbonCompiler;
	DWORD m_dwApplicationModeBitmap;
	std::vector<int> m_commandIdsForContextPopup;
	std::vector<int> m_commandIdsForContextTab;
	std::vector<int> m_applicationModes;

	std::vector<std::wstring> m_commandNames;
	std::vector<std::wstring> m_ContextMapCommandNames;
	std::vector<std::wstring> m_ContextTabMapCommandNames;
	std::map<std::wstring, int> m_commandsName2IdMap;
	std::map<int, std::wstring> m_commandsId2NameMap;

	void ExtractInformationFromXML();
	void ExtractInformationFromHeaderFile();
	void PopulateContextMapIds();
	void PopulateContextMapId(const std::wstring &contextMapCommandName);
	void PopulateContextMapTabIds();
	void PopulateContextMapTabId(const std::wstring &contextMapTabCommandName);
	void PopulateApplicationMode(PCWSTR mode);
	void ConvertApplicationModeBitmapToVector();
	

public:
	CRibbonInfo(const CRibbonCompiler& ribbonCompiler);
	std::vector<int> GetCommandIdsForContextPopup() const { return m_commandIdsForContextPopup; }
	std::vector<int> GetCommandIdsForContextualTabs() const { return m_commandIdsForContextTab; }
	std::vector<int> GetApplicationModes() const { return m_applicationModes; }
	const std::vector<std::wstring> &GetCommandNamesCollection() const { return m_commandNames; }
	
	int GetCommandIdByName(const wstring &commandName) const { return const_cast<CRibbonInfo *>(this)->m_commandsName2IdMap[commandName]; }
	const wstring &GetCommandNameById(int commandId) const { return const_cast<CRibbonInfo *>(this)->m_commandsId2NameMap[commandId]; }

	~CRibbonInfo(void);

};
